home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / rkpls301.zip / RKPDEMO2.ZIP / GENFILE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-04  |  2KB  |  81 lines

  1. Program GenFile;
  2.  
  3. {
  4.  This is a sample programme using RkPlus.  It is a sample of a key file
  5.  generation programme that would be used by the programmer to create
  6.  key files to be distributed to registered users.  The programme itself
  7.  would NOT be distributed, as it would allow users to generate key
  8.  files.  This sample can create a limited use Sample key file or full
  9.  registration key file, for the Sample1 and Sample2 programmes.
  10.  
  11.  GenFile uses the Rkp2Enc unit to cause RkPlus to maintain
  12.  version 2.x/compatible keys.
  13. }
  14.  
  15.  
  16. Uses
  17.   Crt,
  18.   Dos,
  19.   RkPlus,
  20.   Rkp2Enc;
  21.  
  22.  
  23. Const
  24.   MonthNames : Array[1..12] of String[3]
  25.   = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  26.  
  27.  
  28. Var
  29.   kc          : Char;
  30.   ey,em,dd,dw : Word;
  31.  
  32.  
  33. Begin
  34.   OwnerCode := 'ArgleBarbWotsLeeb';
  35.   ProgramCode := 'Sample';
  36.   SetKeyFile('Sample');
  37.   WriteLn('GenFile');
  38.   WriteLn('Key File Generation Programme for Sample1/Sample2');
  39.   WriteLn('See RKPLUS.DOC for more info');
  40.   WriteLn;
  41.   WriteLn('GenFile would be used by the programmer to create key files.');
  42.   WriteLn('It would NOT be distributed.');
  43.   WriteLn;
  44.   Write('Enter name of person to register : ');
  45.   ReadLn(Rkp.Name1);
  46.   WriteLn;
  47.   Write('Is this a limited use demo? ');
  48.   kc := UpCase(ReadKey);
  49.   WriteLn(kc);
  50.   WriteLn;
  51.   If (kc in ['Y','y']) then Begin
  52.     GetDate(ey,em,dd,dw);
  53.     If (em = 12) then Begin
  54.       em := 1;
  55.       Inc(ey);
  56.     End Else
  57.       Inc(em);
  58.     WriteLn('Creating limited use demo key (will expire 1-',MonthNames[em],'-',ey,')');
  59.     Rkp.Level := 0;
  60.     Rkp.ExpYear := ey;
  61.     Rkp.ExpMonth := em;
  62.     Rkp.ExpDay := 0;
  63.   End Else Begin
  64.     WriteLn('Creating unlimited registration key');
  65.     Rkp.Level := 1;
  66.     Rkp.ExpYear := 0;
  67.     Rkp.ExpMonth := 0;
  68.     Rkp.ExpDay := 0;
  69.   End;
  70.   Rkp.ID := '(c) Serious Cybernetics';
  71.   Rkp.Message := 'GenFile';
  72.   Rkp.Name2 := '';
  73.   Rkp.Name3 := '';
  74.   CreateKey;
  75.   SaveRegInfo;
  76.   If Rkp.Registered then
  77.     WriteLn(KeyFileName,' created.')
  78.   Else
  79.     WriteLn('Error ',RkpError,' creating file.');
  80. End.
  81.